<template>
  <el-button @click="f(1)">成功</el-button>
  <el-button @click="f(2)">警告</el-button>
  <el-button @click="f(3)">错误</el-button>
  <el-button @click="f(4)">普通</el-button>
  <el-button @click="f(5)">可关闭</el-button>
</template>

<script setup>
import{ElMessage} from "element-plus"
const f=(x)=>{
  switch (x){
    case 1:
      ElMessage.success("成功");
      break;
    case 2:
      ElMessage.warning("警告");
      break;
    case 3:
      ElMessage.error("错误");
      break;
    case 4:
      ElMessage("普通");
      break;
    case 5:
      ElMessage(
          {
            message:"可关闭普通消息",
            showClose:true
          }
      );

  }
}
</script>

<style scoped>

</style>